<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf" %>
<script type="text/javascript" src="${ctx}/js/qc/cd/cd_edit.js">
</script>
	<link href="${ctx}/css/switcher.css" rel="stylesheet">
<style type="text/css">
.col-sm-3 {
	width: 20%;
	float: left;
}

.col-sm-9 {
	width: 50%;
	float: left;
}
label[class^="btn btn-default"]{
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>

	<form id="form" name="form" class="form-horizontal" method="post"
		  action="${ctx}/wi/editWi.shtml">
		<input type="hidden" class="form-control checkacc" value="${wi.id}"
			   name="warehouseFormMap.id" id="id">
		<section class="panel panel-default">
			<div class="panel-body">
			</div>

			<input type="hidden" value="${wi.product_count_code}" id="detection_code">
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">仓库质检编号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh"  value="${wi.product_count_code}"
						   placeholder="" name="warehouseFormMap.product_count_code" id="product_count_code" readonly="readonly">
				</div>
			</div>
			<%--<div class="line line-dashed line-lg pull-in"></div>--%>
			<%--<div class="form-group">--%>
				<%--<label class="col-sm-3 control-label">检验项目</label>--%>
				<%--<div class="col-sm-9">--%>
					<%--<div class="input-group">--%>
						<%--<input type="text" class="form-control" placeholder=""  value="${wi.detection_pproduct}"--%>
							   <%--name="warehouseFormMap.detection_pproduct" id="detection_pproduct" readonly="readonly">--%>
						<%--<span class="input-group-btn">--%>
						<%--<button class="btn btn-info" id="workorder" type="button"--%>
								<%--style="height: 34px;"--%>
								<%--onclick="getDetection();">--%>
							<%--<span class="glyphicon glyphicon-search"></span>--%>
						<%--</button>--%>
					<%--</span>--%>
					<%--</div>--%>
				<%--</div>--%>
			<%--</div>--%>



			<div class="form-group">
				<label class="col-sm-3 control-label">抽检数</label>
				<div class="col-sm-9">
					<input type="text" class="form-control"  value="${wi.sampling}"
						   name="warehouseFormMap.sampling"
						   id="sampling">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">不合格数</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName"  value="${wi.unqalified}"
						   placeholder="" name="warehouseFormMap.unqalified" id="unqalified">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">合格率</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName" readonly="readonly"  value="${wi.percent_pass}"
						   placeholder="" name="warehouseFormMap.percent_pass" id="percent_pass">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">检验时间</label>
				<div class="col-sm-9">
					<input type="date" class="form-control"
						   name="warehouseFormMap.detection_time"  value="${wi.detection_time}"
						   id="detection_time">
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-3 control-label">检验人</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName"  value="${wi.surveyor}"
						   placeholder="" name="warehouseFormMap.surveyor" id="surveyor">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">检验结果</label>
				<div class="col-sm-9">
					<select class="form-control" name="warehouseFormMap.the_result" id="the_result" >
						<c:choose>
							<c:when test="${wi.the_result eq '通过'}">
								<option value="通过" selected="selected">通过</option>
								<option value="未通过">未通过</option>
							</c:when>
							<c:otherwise>
								<option value="通过">通过</option>
								<option value="未通过" selected="selected">未通过</option>
							</c:otherwise>
						</c:choose>

					</select>
				</div>
			</div>

			</div>
			<footer class="panel-footer text-right bg-light lter">
				<button type="submit" class="btn btn-success btn-s-xs">提交</button>
			</footer>
		</section>
	</form>



	<table id="table_Id"  class="bTable table table-striped table-bordered table-hover table-condensed">
		<thead>
		<tr>
			<th>id</th>
			<th>检验内容</th>
			<th>检验标准</th>
			<th>检验记录</th>
			<th>不合格数量</th>
			<th>合格数量</th>
			<th>结果判定</th>
		</tr>
		<c:forEach var="mc" items="${cd}" varStatus="userStatus">
			<c:choose>
				<c:when test="${userStatus.index == 0}">
					<tr id="myfirst">
						<td id="${userStatus.index}">${mc.materialId}</td>
						<td>${mc.ly_content}</td>
						<td>测试</td>
						<td><input id="record${userStatus.index}" style= "background-color:transparent;border:0;width: 56px"  value="${mc.record}"></td>
						<td><input id="no_number${userStatus.index}" style= "background-color:transparent;border:0;width: 85px" value="${mc.no_number}"></td>
						<th rowspan="100" style="text-align: center; vertical-align: middle;" ><input  style= "background-color:transparent;border:0;width: 50px"  id="qualified" value="${mc.qualified}"></th>
						<th rowspan="100" style="text-align: center; vertical-align: middle;"><div class="form-check form-check-inline">
							<input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1" checked ='checked'>
						</div>
						</th>
					</tr>
				</c:when>
				<c:otherwise>
					<tr id="mytow">
						<td id="${userStatus.index}">${mc.materialId}</td>
						<td>${mc.ly_content}</td>
						<td>测试</td>
						<td><input id="record${userStatus.index}" style= "background-color:transparent;border:0;width: 56px"  value="${mc.record}"></td>
						<td><input id="no_number${userStatus.index}" style= "background-color:transparent;border:0;width: 85px"  value="${mc.no_number}"></td>
					</tr>
				</c:otherwise>
			</c:choose>
		</c:forEach>
		</thead>
		<tbody id="addBody">
		</tbody>
	</table>


	<script src="${ctx}/js/public/jquery.switcher.js"></script>
	<script type="text/javascript">
		$.switcher();
	</script>
<script type="text/javascript">
	$("#unqalified").bind("input propertychange",function(event){
		//获取sampling 数据
		var sa = $("#sampling").val();
		//判断sa是否有数据
		if(sa==''||sa==undefined||sa==null ){
			return;
		}
		var num = parseInt(sa);
		var num2 = parseInt($("#unqalified").val());
		$("#percent_pass").val((100 - (Math.round(num2 / num * 10000) / 100)) + "%");
	});
</script>
</body>
</html>